package com.poetize.plus.entity.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.poetize.plus.entity.po.Family;
import io.swagger.v3.oas.annotations.media.Schema;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * @Author zuosy
 * @Date 2024/5/13 20:39
 **/
public record FamilyVO(
        @Schema(description = "ID")
        Long id,

        @Schema(description = "男生头像")
        String manCover,

        @Schema(description = "女生头像")
        String womanCover,

        @Schema(description = "男生名称")
        String manName,

        @Schema(description = "女生头像")
        String womanName,

        @Schema(description = "相遇时间")
        @JsonFormat(pattern = "yyyy-MM-dd")
        LocalDate startDate,

        @Schema(description = "是否启用")
        Boolean status
) {

    /**
     * 实体类转VO
     *
     * @param family
     * @return
     */
    public static FamilyVO convert(Family family) {
        return new FamilyVO(family.getId(), family.getManCover(), family.getWomanCover(), family.getManName(), family.getWomanName(), family.getStartDate(), family.getStatus());
    }
}
